package com.asialjim.wechat.apiservice.executor;

import com.asialjim.wechat.apiservice.Api;
import com.asialjim.wechat.apiservice.HttpMethod;
import org.apache.http.HttpHost;

/**
 * <h1><em>ASIAL JIM JAVA DOC</em></h1><hr/>
 * <h2>CLASS DESCRIPTION <i>[ NAME: ApiExecutorBuilder ]</i></h2><strong>
 * <p> api executor builder
 * </strong><p><p><em>Copyright &copy; Asial Jim Co., LTD</em><hr/>
 *
 * @author Asial Jim &nbsp;&nbsp; <span>Email:<a href="mailto:asialjim@hotmail.com">asialjim@hotmail.com</a> &nbsp;&nbsp; <a href="asialjim@qq.com">asialjim@qq.com</a></span>
 * @version 1.0.0
 * @since 2021/3/1   &nbsp;&nbsp; JDK 8
 */
public class ApiExecutorBuilder {

    public static ApiExecutor build(Api api, HttpHost httpProxy, String domain, String tempFilePath){
        return build(api.getHttpMethod(),httpProxy,domain,tempFilePath);
    }

    public static ApiExecutor build(HttpMethod method, HttpHost httpProxy, String domain, String tempDirFile){
        switch (method){
            case GET:
                return new GetApiExecutor(httpProxy,domain,tempDirFile);
            case POST:
                return new PostApiExecutor(httpProxy,domain,tempDirFile);
            default:
                return null;
        }
    }
}